/**
 * Created by lenovo on 2017/4/14.
 */
function login() {
    var $username = $("#username").val();
    var $password = $("#password").val();
    var $salt = $("#salt").val();
    var md5password = b64_md5($salt+$password);
    if ("" == $username) {
        return false;
    }
    if ("" == $password) {
        return false;
    }
    $.ajax({
        type:"GET",
        url: "/Home/Login",
        data:{username:$username,password:md5password,salt:$salt},
        success:function(data){
            console.log(data);
            if(data.State <= 0){
                $("#error").html(data.Msg);
            }else if (data.State > 0){
                localStorage.setItem("user",data.Data);
                $("#username").val("");
                $("#password").val("");
                location.href = "../../app.html";
            }else{
                alert("出错了！请重试！");
                location.reload();
            }
        }
    });
    return false;
}